package com.linhh.mall.center.common.exception;

import com.linhh.mall.center.common.util.ResultEnum;


/**
 * @Author linhh
 * @Date 2022 10 16 11 40
 * 自定义以异常处理类
 **/
public class DefinitionException extends RuntimeException {

    /**
     * 错误编码
     */
    private Integer errorCode;

    /**
     * 错误信息
     */
    private String errorMessage;

    public DefinitionException(ResultEnum resultEnum){
        this.errorCode = resultEnum.getCode();
        this.errorMessage = resultEnum.getMessage();
    }

    public DefinitionException(String errorMessage){
        this.errorMessage = errorMessage;
    }

    public Integer getErrorCode() {
        return errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }
}
